## API Report File for "@backstage/integration"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts
import { Config } from '@backstage/config';
import { ConsumedResponse } from '@backstage/errors';
import { RestEndpointMethodTypes } from '@octokit/rest';

// @public
export class AwsS3Integration implements ScmIntegration {
  constructor(integrationConfig: AwsS3IntegrationConfig);
  // (undocumented)
  get config(): AwsS3IntegrationConfig;
  // (undocumented)
  static factory: ScmIntegrationsFactory<AwsS3Integration>;
  // (undocumented)
  resolveEditUrl(url: string): string;
  // (undocumented)
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number | undefined;
  }): string;
  // (undocumented)
  get title(): string;
  // (undocumented)
  get type(): string;
}

// @public
export type AwsS3IntegrationConfig = {
  host: string;
  endpoint?: string;
  s3ForcePathStyle?: boolean;
  accessKeyId?: string;
  secretAccessKey?: string;
  roleArn?: string;
  externalId?: string;
};

// @public
export type AzureClientSecretCredential = AzureCredentialBase & {
  kind: 'ClientSecret';
  tenantId: string;
  clientId: string;
  clientSecret: string;
};

// @public
export type AzureCredentialBase = {
  kind: AzureDevOpsCredentialKind;
  organizations?: string[];
};

// @public
export type AzureDevOpsCredential =
  | AzureClientSecretCredential
  | AzureManagedIdentityCredential
  | PersonalAccessTokenCredential;

// @public
export type AzureDevOpsCredentialKind =
  | 'PersonalAccessToken'
  | 'ClientSecret'
  | 'ManagedIdentity';

// @public
export type AzureDevOpsCredentialLike = Omit<
  Partial<AzureClientSecretCredential> &
    Partial<AzureManagedIdentityCredential> &
    Partial<PersonalAccessTokenCredential>,
  'kind'
>;

// @public
export type AzureDevOpsCredentials = {
  headers: {
    [name: string]: string;
  };
  token: string;
  type: AzureDevOpsCredentialType;
};

// @public
export interface AzureDevOpsCredentialsProvider {
  // (undocumented)
  getCredentials(opts: {
    url: string;
  }): Promise<AzureDevOpsCredentials | undefined>;
}

// @public
export type AzureDevOpsCredentialType = 'bearer' | 'pat';

// @public
export class AzureIntegration implements ScmIntegration {
  constructor(integrationConfig: AzureIntegrationConfig);
  // (undocumented)
  get config(): AzureIntegrationConfig;
  // (undocumented)
  static factory: ScmIntegrationsFactory<AzureIntegration>;
  // (undocumented)
  resolveEditUrl(url: string): string;
  // (undocumented)
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number;
  }): string;
  // (undocumented)
  get title(): string;
  // (undocumented)
  get type(): string;
}

// @public
export type AzureIntegrationConfig = {
  host: string;
  token?: string;
  credential?: AzureDevOpsCredential;
  credentials?: AzureDevOpsCredential[];
};

// @public
export type AzureManagedIdentityCredential = AzureCredentialBase & {
  kind: 'ManagedIdentity';
  clientId: string;
};

// @public
export class BitbucketCloudIntegration implements ScmIntegration {
  constructor(integrationConfig: BitbucketCloudIntegrationConfig);
  // (undocumented)
  get config(): BitbucketCloudIntegrationConfig;
  // (undocumented)
  static factory: ScmIntegrationsFactory<BitbucketCloudIntegration>;
  // (undocumented)
  resolveEditUrl(url: string): string;
  // (undocumented)
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number;
  }): string;
  // (undocumented)
  get title(): string;
  // (undocumented)
  get type(): string;
}

// @public
export type BitbucketCloudIntegrationConfig = {
  host: string;
  apiBaseUrl: string;
  username?: string;
  appPassword?: string;
};

// @public @deprecated
export class BitbucketIntegration implements ScmIntegration {
  constructor(integrationConfig: BitbucketIntegrationConfig);
  // (undocumented)
  get config(): BitbucketIntegrationConfig;
  // (undocumented)
  static factory: ScmIntegrationsFactory<BitbucketIntegration>;
  // (undocumented)
  resolveEditUrl(url: string): string;
  // (undocumented)
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number;
  }): string;
  // (undocumented)
  get title(): string;
  // (undocumented)
  get type(): string;
}

// @public @deprecated
export type BitbucketIntegrationConfig = {
  host: string;
  apiBaseUrl: string;
  token?: string;
  username?: string;
  appPassword?: string;
};

// @public
export class BitbucketServerIntegration implements ScmIntegration {
  constructor(integrationConfig: BitbucketServerIntegrationConfig);
  // (undocumented)
  get config(): BitbucketServerIntegrationConfig;
  // (undocumented)
  static factory: ScmIntegrationsFactory<BitbucketServerIntegration>;
  // (undocumented)
  resolveEditUrl(url: string): string;
  // (undocumented)
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number;
  }): string;
  // (undocumented)
  get title(): string;
  // (undocumented)
  get type(): string;
}

// @public
export type BitbucketServerIntegrationConfig = {
  host: string;
  apiBaseUrl: string;
  token?: string;
  username?: string;
  password?: string;
};

// @public
export function buildGerritGitilesArchiveUrl(
  config: GerritIntegrationConfig,
  project: string,
  branch: string,
  filePath: string,
): string;

// @public
export class DefaultAzureDevOpsCredentialsProvider
  implements AzureDevOpsCredentialsProvider
{
  // (undocumented)
  static fromIntegrations(
    integrations: ScmIntegrationRegistry,
  ): DefaultAzureDevOpsCredentialsProvider;
  // (undocumented)
  getCredentials(opts: {
    url: string;
  }): Promise<AzureDevOpsCredentials | undefined>;
}

// @public
export class DefaultGithubCredentialsProvider
  implements GithubCredentialsProvider
{
  // (undocumented)
  static fromIntegrations(
    integrations: ScmIntegrationRegistry,
  ): DefaultGithubCredentialsProvider;
  getCredentials(opts: { url: string }): Promise<GithubCredentials>;
}

// @public
export class DefaultGitlabCredentialsProvider
  implements GitlabCredentialsProvider
{
  // (undocumented)
  static fromIntegrations(
    integrations: ScmIntegrationRegistry,
  ): DefaultGitlabCredentialsProvider;
  // (undocumented)
  getCredentials(opts: { url: string }): Promise<GitlabCredentials>;
}

// @public
export function defaultScmResolveUrl(options: {
  url: string;
  base: string;
  lineNumber?: number;
}): string;

// @public
export class GerritIntegration implements ScmIntegration {
  constructor(integrationConfig: GerritIntegrationConfig);
  // (undocumented)
  get config(): GerritIntegrationConfig;
  // (undocumented)
  static factory: ScmIntegrationsFactory<GerritIntegration>;
  // (undocumented)
  resolveEditUrl(url: string): string;
  // (undocumented)
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number;
  }): string;
  // (undocumented)
  get title(): string;
  // (undocumented)
  get type(): string;
}

// @public
export type GerritIntegrationConfig = {
  host: string;
  baseUrl?: string;
  cloneUrl?: string;
  gitilesBaseUrl?: string;
  username?: string;
  password?: string;
};

// @public
export function getAzureCommitsUrl(url: string): string;

// @public
export function getAzureDownloadUrl(url: string): string;

// @public
export function getAzureFileFetchUrl(url: string): string;

// @public @deprecated
export function getAzureRequestOptions(
  config: AzureIntegrationConfig,
  additionalHeaders?: Record<string, string>,
): Promise<{
  headers: Record<string, string>;
}>;

// @public
export function getBitbucketCloudDefaultBranch(
  url: string,
  config: BitbucketCloudIntegrationConfig,
): Promise<string>;

// @public
export function getBitbucketCloudDownloadUrl(
  url: string,
  config: BitbucketCloudIntegrationConfig,
): Promise<string>;

// @public
export function getBitbucketCloudFileFetchUrl(
  url: string,
  config: BitbucketCloudIntegrationConfig,
): string;

// @public
export function getBitbucketCloudRequestOptions(
  config: BitbucketCloudIntegrationConfig,
): {
  headers: Record<string, string>;
};

// @public @deprecated
export function getBitbucketDefaultBranch(
  url: string,
  config: BitbucketIntegrationConfig,
): Promise<string>;

// @public @deprecated
export function getBitbucketDownloadUrl(
  url: string,
  config: BitbucketIntegrationConfig,
): Promise<string>;

// @public @deprecated
export function getBitbucketFileFetchUrl(
  url: string,
  config: BitbucketIntegrationConfig,
): string;

// @public @deprecated
export function getBitbucketRequestOptions(
  config: BitbucketIntegrationConfig,
): {
  headers: Record<string, string>;
};

// @public
export function getBitbucketServerDefaultBranch(
  url: string,
  config: BitbucketServerIntegrationConfig,
): Promise<string>;

// @public
export function getBitbucketServerDownloadUrl(
  url: string,
  config: BitbucketServerIntegrationConfig,
): Promise<string>;

// @public
export function getBitbucketServerFileFetchUrl(
  url: string,
  config: BitbucketServerIntegrationConfig,
): string;

// @public
export function getBitbucketServerRequestOptions(
  config: BitbucketServerIntegrationConfig,
): {
  headers: Record<string, string>;
};

// @public
export function getGerritBranchApiUrl(
  config: GerritIntegrationConfig,
  url: string,
): string;

// @public
export function getGerritCloneRepoUrl(
  config: GerritIntegrationConfig,
  url: string,
): string;

// @public
export function getGerritFileContentsApiUrl(
  config: GerritIntegrationConfig,
  url: string,
): string;

// @public
export function getGerritProjectsApiUrl(
  config: GerritIntegrationConfig,
): string;

// @public
export function getGerritRequestOptions(config: GerritIntegrationConfig): {
  headers?: Record<string, string>;
};

// @public
export function getGiteaArchiveUrl(
  config: GiteaIntegrationConfig,
  url: string,
): string;

// @public
export function getGiteaEditContentsUrl(
  config: GiteaIntegrationConfig,
  url: string,
): string;

// @public
export function getGiteaFileContentsUrl(
  config: GiteaIntegrationConfig,
  url: string,
): string;

// @public
export function getGiteaLatestCommitUrl(
  config: GiteaIntegrationConfig,
  url: string,
): string;

// @public
export function getGiteaRequestOptions(config: GiteaIntegrationConfig): {
  headers?: Record<string, string>;
};

// @public @deprecated (undocumented)
export const getGitHubFileFetchUrl: typeof getGithubFileFetchUrl;

// @public
export function getGithubFileFetchUrl(
  url: string,
  config: GithubIntegrationConfig,
  credentials: GithubCredentials,
): string;

// @public @deprecated
export function getGitHubRequestOptions(
  config: GithubIntegrationConfig,
  credentials: GithubCredentials,
): {
  headers: Record<string, string>;
};

// @public
export function getGitLabFileFetchUrl(
  url: string,
  config: GitLabIntegrationConfig,
): Promise<string>;

// @public
export function getGitLabIntegrationRelativePath(
  config: GitLabIntegrationConfig,
): string;

// @public
export function getGitLabRequestOptions(config: GitLabIntegrationConfig): {
  headers: Record<string, string>;
};

// @public
export class GiteaIntegration implements ScmIntegration {
  constructor(config: GiteaIntegrationConfig);
  // (undocumented)
  readonly config: GiteaIntegrationConfig;
  // (undocumented)
  static factory: ScmIntegrationsFactory<GiteaIntegration>;
  // (undocumented)
  resolveEditUrl(url: string): string;
  // (undocumented)
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number | undefined;
  }): string;
  // (undocumented)
  get title(): string;
  // (undocumented)
  get type(): string;
}

// @public
export type GiteaIntegrationConfig = {
  host: string;
  baseUrl?: string;
  username?: string;
  password?: string;
};

// @public
export type GithubAppConfig = {
  appId: number;
  privateKey: string;
  webhookSecret: string;
  clientId: string;
  clientSecret: string;
  allowedInstallationOwners?: string[];
};

// @public
export class GithubAppCredentialsMux {
  constructor(config: GithubIntegrationConfig);
  // (undocumented)
  getAllInstallations(): Promise<
    RestEndpointMethodTypes['apps']['listInstallations']['response']['data']
  >;
  // (undocumented)
  getAppToken(owner: string, repo?: string): Promise<string | undefined>;
}

// @public
export type GithubCredentials = {
  headers?: {
    [name: string]: string;
  };
  token?: string;
  type: GithubCredentialType;
};

// @public
export interface GithubCredentialsProvider {
  // (undocumented)
  getCredentials(opts: { url: string }): Promise<GithubCredentials>;
}

// @public
export type GithubCredentialType = 'app' | 'token';

// @public @deprecated (undocumented)
export class GitHubIntegration extends GithubIntegration {
  constructor(integrationConfig: GitHubIntegrationConfig);
  // (undocumented)
  get config(): GitHubIntegrationConfig;
  // (undocumented)
  static factory: ScmIntegrationsFactory<GitHubIntegration>;
}

// @public
export class GithubIntegration implements ScmIntegration {
  constructor(integrationConfig: GithubIntegrationConfig);
  // (undocumented)
  get config(): GithubIntegrationConfig;
  // (undocumented)
  static factory: ScmIntegrationsFactory<GithubIntegration>;
  // (undocumented)
  parseRateLimitInfo(response: ConsumedResponse): RateLimitInfo;
  // (undocumented)
  resolveEditUrl(url: string): string;
  // (undocumented)
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number;
  }): string;
  // (undocumented)
  get title(): string;
  // (undocumented)
  get type(): string;
}

// @public @deprecated (undocumented)
export type GitHubIntegrationConfig = GithubIntegrationConfig;

// @public
export type GithubIntegrationConfig = {
  host: string;
  apiBaseUrl?: string;
  rawBaseUrl?: string;
  token?: string;
  apps?: GithubAppConfig[];
};

// @public (undocumented)
export type GitlabCredentials = {
  headers?: {
    [name: string]: string;
  };
  token?: string;
};

// @public (undocumented)
export interface GitlabCredentialsProvider {
  // (undocumented)
  getCredentials(opts: { url: string }): Promise<GitlabCredentials>;
}

// @public
export class GitLabIntegration implements ScmIntegration {
  constructor(integrationConfig: GitLabIntegrationConfig);
  // (undocumented)
  get config(): GitLabIntegrationConfig;
  // (undocumented)
  static factory: ScmIntegrationsFactory<GitLabIntegration>;
  // (undocumented)
  resolveEditUrl(url: string): string;
  // (undocumented)
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number;
  }): string;
  // (undocumented)
  get title(): string;
  // (undocumented)
  get type(): string;
}

// @public
export type GitLabIntegrationConfig = {
  host: string;
  apiBaseUrl: string;
  token?: string;
  baseUrl: string;
};

// @public
export type GoogleGcsIntegrationConfig = {
  clientEmail?: string;
  privateKey?: string;
};

// @public
export interface IntegrationsByType {
  // (undocumented)
  awsS3: ScmIntegrationsGroup<AwsS3Integration>;
  // (undocumented)
  azure: ScmIntegrationsGroup<AzureIntegration>;
  // @deprecated (undocumented)
  bitbucket: ScmIntegrationsGroup<BitbucketIntegration>;
  // (undocumented)
  bitbucketCloud: ScmIntegrationsGroup<BitbucketCloudIntegration>;
  // (undocumented)
  bitbucketServer: ScmIntegrationsGroup<BitbucketServerIntegration>;
  // (undocumented)
  gerrit: ScmIntegrationsGroup<GerritIntegration>;
  // (undocumented)
  gitea: ScmIntegrationsGroup<GiteaIntegration>;
  // (undocumented)
  github: ScmIntegrationsGroup<GithubIntegration>;
  // (undocumented)
  gitlab: ScmIntegrationsGroup<GitLabIntegration>;
}

// @public
export function parseGerritGitilesUrl(
  config: GerritIntegrationConfig,
  url: string,
): {
  branch: string;
  filePath: string;
  project: string;
};

// @public
export function parseGerritJsonResponse(response: Response): Promise<unknown>;

// @public
export function parseGiteaUrl(
  config: GiteaIntegrationConfig,
  url: string,
): {
  url: string;
  owner: string;
  name: string;
  ref: string;
  path: string;
};

// @public
export type PersonalAccessTokenCredential = AzureCredentialBase & {
  kind: 'PersonalAccessToken';
  personalAccessToken: string;
};

// @public
export interface RateLimitInfo {
  // (undocumented)
  isRateLimited: boolean;
}

// @public
export function readAwsS3IntegrationConfig(
  config: Config,
): AwsS3IntegrationConfig;

// @public
export function readAwsS3IntegrationConfigs(
  configs: Config[],
): AwsS3IntegrationConfig[];

// @public
export function readAzureIntegrationConfig(
  config: Config,
): AzureIntegrationConfig;

// @public
export function readAzureIntegrationConfigs(
  configs: Config[],
): AzureIntegrationConfig[];

// @public
export function readBitbucketCloudIntegrationConfig(
  config: Config,
): BitbucketCloudIntegrationConfig;

// @public
export function readBitbucketCloudIntegrationConfigs(
  configs: Config[],
): BitbucketCloudIntegrationConfig[];

// @public @deprecated
export function readBitbucketIntegrationConfig(
  config: Config,
): BitbucketIntegrationConfig;

// @public @deprecated
export function readBitbucketIntegrationConfigs(
  configs: Config[],
): BitbucketIntegrationConfig[];

// @public
export function readBitbucketServerIntegrationConfig(
  config: Config,
): BitbucketServerIntegrationConfig;

// @public
export function readBitbucketServerIntegrationConfigs(
  configs: Config[],
): BitbucketServerIntegrationConfig[];

// @public
export function readGerritIntegrationConfig(
  config: Config,
): GerritIntegrationConfig;

// @public
export function readGerritIntegrationConfigs(
  configs: Config[],
): GerritIntegrationConfig[];

// @public
export function readGiteaConfig(config: Config): GiteaIntegrationConfig;

// @public @deprecated (undocumented)
export const readGitHubIntegrationConfig: typeof readGithubIntegrationConfig;

// @public
export function readGithubIntegrationConfig(
  config: Config,
): GithubIntegrationConfig;

// @public @deprecated (undocumented)
export const readGitHubIntegrationConfigs: typeof readGithubIntegrationConfigs;

// @public
export function readGithubIntegrationConfigs(
  configs: Config[],
): GithubIntegrationConfig[];

// @public
export function readGitLabIntegrationConfig(
  config: Config,
): GitLabIntegrationConfig;

// @public
export function readGitLabIntegrationConfigs(
  configs: Config[],
): GitLabIntegrationConfig[];

// @public
export function readGoogleGcsIntegrationConfig(
  config: Config,
): GoogleGcsIntegrationConfig;

// @public @deprecated (undocumented)
export const replaceGitHubUrlType: typeof replaceGithubUrlType;

// @public
export function replaceGithubUrlType(
  url: string,
  type: 'blob' | 'tree' | 'edit',
): string;

// @public
export function replaceGitLabUrlType(
  url: string,
  type: 'blob' | 'tree' | 'edit',
): string;

// @public
export interface ScmIntegration {
  resolveEditUrl(url: string): string;
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number;
  }): string;
  title: string;
  type: string;
}

// @public
export interface ScmIntegrationRegistry
  extends ScmIntegrationsGroup<ScmIntegration> {
  // (undocumented)
  awsS3: ScmIntegrationsGroup<AwsS3Integration>;
  // (undocumented)
  azure: ScmIntegrationsGroup<AzureIntegration>;
  // @deprecated (undocumented)
  bitbucket: ScmIntegrationsGroup<BitbucketIntegration>;
  // (undocumented)
  bitbucketCloud: ScmIntegrationsGroup<BitbucketCloudIntegration>;
  // (undocumented)
  bitbucketServer: ScmIntegrationsGroup<BitbucketServerIntegration>;
  // (undocumented)
  gerrit: ScmIntegrationsGroup<GerritIntegration>;
  // (undocumented)
  gitea: ScmIntegrationsGroup<GiteaIntegration>;
  // (undocumented)
  github: ScmIntegrationsGroup<GithubIntegration>;
  // (undocumented)
  gitlab: ScmIntegrationsGroup<GitLabIntegration>;
  resolveEditUrl(url: string): string;
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number;
  }): string;
}

// @public
export class ScmIntegrations implements ScmIntegrationRegistry {
  constructor(integrationsByType: IntegrationsByType);
  // (undocumented)
  get awsS3(): ScmIntegrationsGroup<AwsS3Integration>;
  // (undocumented)
  get azure(): ScmIntegrationsGroup<AzureIntegration>;
  // @deprecated (undocumented)
  get bitbucket(): ScmIntegrationsGroup<BitbucketIntegration>;
  // (undocumented)
  get bitbucketCloud(): ScmIntegrationsGroup<BitbucketCloudIntegration>;
  // (undocumented)
  get bitbucketServer(): ScmIntegrationsGroup<BitbucketServerIntegration>;
  // (undocumented)
  byHost(host: string): ScmIntegration | undefined;
  // (undocumented)
  byUrl(url: string | URL): ScmIntegration | undefined;
  // (undocumented)
  static fromConfig(config: Config): ScmIntegrations;
  // (undocumented)
  get gerrit(): ScmIntegrationsGroup<GerritIntegration>;
  // (undocumented)
  get gitea(): ScmIntegrationsGroup<GiteaIntegration>;
  // (undocumented)
  get github(): ScmIntegrationsGroup<GithubIntegration>;
  // (undocumented)
  get gitlab(): ScmIntegrationsGroup<GitLabIntegration>;
  // (undocumented)
  list(): ScmIntegration[];
  // (undocumented)
  resolveEditUrl(url: string): string;
  // (undocumented)
  resolveUrl(options: {
    url: string;
    base: string;
    lineNumber?: number;
  }): string;
}

// @public
export type ScmIntegrationsFactory<T extends ScmIntegration> = (options: {
  config: Config;
}) => ScmIntegrationsGroup<T>;

// @public
export interface ScmIntegrationsGroup<T extends ScmIntegration> {
  byHost(host: string): T | undefined;
  byUrl(url: string | URL): T | undefined;
  list(): T[];
}

// @public
export class SingleInstanceGithubCredentialsProvider
  implements GithubCredentialsProvider
{
  // (undocumented)
  static create: (config: GithubIntegrationConfig) => GithubCredentialsProvider;
  getCredentials(opts: { url: string }): Promise<GithubCredentials>;
}
```
